export default {
  name: 'wt-menu',
  components: {},
  props: {
    data: {
      type: Array,
      default: () => []
    }
  },
  data() {
    return {}
  },
  render(h) {
    let renderChildren = data => {
      return data.map(child => {
        return child.children ? (
          <ElSubmenu index={child.index}>
            <div slot="title">{child.label}</div>
            {renderChildren(child.children)}
          </ElSubmenu>
        ) : (
          <ElMenuItem index={child.index}>{child.label}</ElMenuItem>
        )
      })
    }
    return <ElMenu>{renderChildren(this.data)}</ElMenu>
  }
}
